<template>
	<view class="content">
		<view class="wrap">
			<u-swiper :height="300" :interval="5000" mode="rect" :list="swiper" :effect3d="true"></u-swiper>
		</view>
		<view class="notice">
			<u-notice-bar type="error" :duration="5000" mode="vertical" :is-circular="false" :list="list"></u-notice-bar>
		</view>
		<view class="button-demo">
			<u-button type="primary" :ripple="true" :customStyle="customStyle" @click="toForm1">返沙人员信息填报</u-button>
		</view>
		<view class="button-demo">
			<u-button type="success" :ripple="true" :customStyle="customStyle" @click="toForm2">疫苗接种人员信息填报</u-button>
		</view>
		<view class="button-demo">
			<u-button type="warning" :ripple="true" :customStyle="customStyle" @click="toForm3">购药人员自主填报</u-button>
		</view>
		<view class="d_footer">
			<u-link href="https://syzhichuang.com/about-39.html" :color="'#8b8b8b'" class="des">沙雅之窗网络工作室提供技术支持</u-link>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				customStyle: {
					width: '420rpx',
					height: '100rpx',
					lineHeight: '100rpx'
				},
				list: [],
				swiper: [],
				src: '../../static/syzc.png'
			}
		},
		onLoad() {
			this.getPosterFunc()
			this.getSwiperFunc()
		},
		methods: {
			//延迟跳转，保留特效
			toForm1(){
				setTimeout(() => {
					this.$u.route('pages/form1/form1')
				}, 500)
			},
			toForm2(){
				setTimeout(() => {
					this.$u.route('pages/form2/form2')
				}, 500)
			},
			toForm3(){
				setTimeout(() => {
					this.$u.route('pages/form3/form3')
				}, 500)
			},
			async getPosterFunc(){
				const {
					code,
					data
				} = await this.$u.api.getPosterList()
				if (code == 1) {
					if (data.length > 0) {
						this.list = data
					}
				}
			},
			async getSwiperFunc(){
				const {
					code,
					data
				} = await this.$u.api.getSwiperList()
				if (code == 1) {
					if (data.length > 0) {
						this.swiper = data
					}
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.wrap {
		padding-bottom: 40rpx;
		width: 100%;
	}
	.notice {
		width: 100%;
	}
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 40rpx 20rpx;
	}

	.button-demo {
		margin-top: 80rpx;
	}
	
	.link-demo {
		margin-top: 80rpx;
	}
	
	.d_footer{
		position: fixed;
		bottom: 50rpx;
		left: 0;
		right: 0;
	}
	.des{
		display: block;
		text-align: center;
		font-size: 28rpx;
	}
</style>
